<h1>MorphGradientFill</h1>

<p>MorphGradientFill defines how a colour changes across an area filled in a 
morphing shape. Two type of gradient fill are supported:</p>

<table>

<tr>
<td>Linear</td>
<td>The gradient changes in one direction across the area to be filled.</td>
</tr>

<tr>
<td>Radial</td>
<td>The gradient changes radially from the centre of the area to be filled.</td>
</tr>

</table>

<p>Gradients are defined in terms of a  standard space called the gradient square, 
centred at (0,0) and extending from (-16384, -16384) to (16384, 16384).</p>

<img src="gradientSquare.gif">

<p>A coordinate transform is required to map the gradient square to the 
coordinates of the filled area. The transformation is applied in two steps. 
First the gradient square is scaled so the colour covers the shape followed by 
a translation to map the gradient square coordinates to the coordinate range of 
the shape.</p>

<img src="gradientMapping.gif">

<p>A series of control points is used to control how the colour displayed changes 
across the gradient. At least two control points are required to define a 
gradient - one for the starting colour and one for the final colour. Up to 
eight control points may be specified to generate complex colour transitions. 
When the Flash Player displays the control points they are sorted by the ratio 
defined in each Gradient, with the smallest ratio value displayed first.
</p>

<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top">type</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>The type of gradient fill, either Linear or Radial.</td>
</tr>

<tr>
<td nowrap valign="top">startTransform</td>
<td nowrap valign="top">CoordTransform</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The coordinate transform used to map the logical coordinates of the gradient
square on to a set of physical coordinates at the start of the morphing process.</td>
</tr>

<tr>
<td nowrap valign="top">endTransform</td>
<td nowrap valign="top">CoordTransform</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>The coordinate transform used to map the logical coordinates of the gradient
square on to a set of physical coordinates at the end of the morphing process.</td>
</tr>

<tr>
<td nowrap valign="top">gradients</td>
<td nowrap valign="top">Gradient[n]</td>
<td nowrap valign="top" align="right">&nbsp;</td>
<td>An array of up to eight Gradients that define the control points 
across the gradient square that control the colour transitions. The Flash 
Player performs the interpolation of the colour values between the control 
points.</td>
</tr>

</table>

<p>In addition to specifying the type of gradient fill that will be displayed 
the type attribute may be used when iterating through an array of fill style 
objects to identify the type of fill style without using run-time type checking.</p>

<h2>History</h2>

<p>MorphGradientFill represents the MorphFillStyle structure from 
the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 3.</p>
